#include <stdio.h>

//https://www.nowcoder.com/practice/0948f4f3344c452f843afd3585dd0f8d?tpId=290&tqId=320953&ru=/exam/oj/ta&qru=/ta/beginner-programmers/question-ranking&sourceUrl=%2Fexam%2Foj%2Fta%3FtpId%3D290

int main() {
    int num  = 2019;
    int count = 0;
    do {
        int i = num;
        while (i) {
            if (i % 10 == 9) {
                count++;
                break;
            } else {
                i /= 10;
            }
        }
    } while (--num);
    printf("%d", count);
    return 0;
}
